/*
 * CommandAvancer.h
 *
 *  Created on: 2 janv. 2012
 *      Author: mnemoi
 */

#ifndef COMMANDAVANCER_H_
#define COMMANDAVANCER_H_
#include "Command.h"
#include "CommandRobot.h"


class CommandAvancer: public Command, public CommandRobot {

public:
	static CommandAvancer maCmd;

	int ansX;
	int ansY;

	CommandAvancer(Robot*rob=NULL,string d=(string)"AVANCER") : CommandRobot(rob),Command(d) {
		if(rob){
		ansX = rob->getPosition().getX();
		ansY = rob->getPosition().getY();
		}
	}
	CommandAvancer(string str):Command(str),CommandRobot(){}
	CommandAvancer* constVirtual(Robot *rob) {
		return new CommandAvancer(rob);
	}
	void executer() {
		//Appel de l'invocateur jsé pas cmt encore (static)
		//inv.getInt() 2 fois
		int x = inv.getInt();
		int y = inv.getInt();
		r->avancer(x,y);
	}
	void annuler() {
		r->avancer(ansX,ansY);
	}

};

#endif /* COMMANDAVANCER_H_ */
